package com.zhanggm.springboot.demo.controller;

import com.zhanggm.springboot.demo.bean.UserBean;
import com.zhanggm.springboot.demo.config.JdbcConfig;
import com.zhanggm.springboot.demo.config.UploadFileConfig;
import com.zhanggm.springboot.demo.mapper.UserMapper;
import com.zhanggm.springboot.demo.service.Task2Service;
import com.zhanggm.springboot.demo.service.TaskService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class TestController {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private UploadFileConfig uploadFileConfig;

    @Autowired
    private JdbcConfig jdbcConfig;

    @Autowired
    private UserBean userBean;

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private TaskService taskService;

    @Autowired
    private Task2Service task2Service;

    @RequestMapping("hello")
    public Object hello(){
        System.out.println(uploadFileConfig.getDomain());
        System.out.println(uploadFileConfig.getPath());
        System.out.println(jdbcConfig.getDriverClassName());
//        System.out.println(userBean);
        return "springBoot hello";
    }
    @RequestMapping("task")
    public String task() throws InterruptedException {
        taskService.task1();
        task2Service.task2();
        logger.info("task："+new Date());
        return "task";
    }



}
